<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/style/cssMain.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/style/jQuery.js"></script>
    <script type="text/javascript" src="/style/jsMain.js"></script>
  </head>
  
  <body>
    <div id="eBody">
      <div class="eTitle">(小店)添加/编辑</div>
      <div class="eTag">
        <ul>
          <li class="eSelected">基本信息</li>
        </ul>
      </div>
      <form action="<?php echo site_url('mang/store/action'); ?>?id=<?php echo $store['id']; ?>" method="post">
      	<input type="hidden" id="id" name="id" value="<?php echo $store['id']?>"/>
      <div class="eSheet eBorder">
        <?php echo validation_errors(); ?>
        <div class="eEdit">
        	<table cellspacing="10">
        		<tr>
        			<td>名称：</td>
        			<td><input id="store_name" class="text" name="store_name" type="text" value="<?php echo $store['name'] ?>" /></td>
        		</tr>
        		<tr>
        			<td>所在街道编号：</td>
        			<td><input id="store_id" class="text" name="store_id" type="text" value="<?php echo $store['street'] ?>" /></td>
        		</tr>
        		<tr>
        			<td>地址：</td>
        			<td><input id="store_url" class="text" name="store_url" type="text" value="<?php echo $store['address'] ?>" /></td>
        		</tr>
        		<tr>
        			<td>英文地址：</td>
        			<td><input id="eaddress" class="text" name="eaddress" type="text" value="<?php echo $store['eaddress'] ?>" /></td>
        		</tr>
        		<tr>
        			<td>小店分类：</td>
        			<td>
						<select name="storetype" id="storetype" style="height: 25px;width: 60px;line-height: 25px;margin-right: 5px;">
                                                       	<option value="shenghuo">生活</option>
                                                       	<option value="fushi">服饰</option>
                                                       	<option value="wenhua">文化</option>
                                                       	<option value="xiuxian">休闲</option>
                                                       	<option value="meishi">美食</option>	
                                                       </select>
                                                       <select name="storetypes" id="storetypes" style="height: 25px;width: 100px;line-height: 25px;margin-right: 5px;">
                                                       	<?php foreach ($shenghuoList as $shenghuo):?>
                                                       		<option value="<?php echo $shenghuo['code']?>"><?php echo $shenghuo['value']?></option>
                                                       	<?php endforeach;?>
                                                       </select>
					</td>
        		</tr>
        		<tr>
        			<td>原创品牌：</td>
        			<td>
  						<select name="storebrand" id="storebrand" style="height: 25px;width: 100px;line-height: 25px;margin-right: 5px;">
                            <?php foreach ($ycpp as $sb):?>
                        	<option <?php if($sb['code'] == $store['storebrand']):?>SELECTED<?php endif?> value="<?php echo $sb['code']?>"><?php echo $sb['value']?></option>
                         	<?php endforeach;?>
                        </select>
					</td>
        		</tr>
        		<tr>
        			<td>名人开店：</td>
        			<td>
  						<select name="storebrand" id="storebrand" style="height: 25px;width: 100px;line-height: 25px;margin-right: 5px;">
                            <?php foreach ($storeperson as $sb):?>
                        	<option <?php if($sb['code'] == $store['storeperson']):?>SELECTED<?php endif?> value="<?php echo $sb['code']?>"><?php echo $sb['value']?></option>
                         	<?php endforeach;?>
                        </select>
					</td>
        		</tr>
        		<tr>
        			<td>特色商圈：</td>
        			<td>
  						 <select name="storespebus" id="storespebus" style="height: 25px;width: 100px;line-height: 25px;margin-right: 5px;">
                                                       	<option value="tsqy">特色区域</option>
                                                       	<option value="yishu">艺术中心</option>
                                                       	<option value="ditie">地铁小店</option>
                                                       </select>
                                                       <select name="storespebuss" id="storespebuss" style="height: 25px;width: 100px;line-height: 25px;margin-right: 5px;">
                                                       	<?php foreach ($tsqyList as $tsqy):?>
                                                       		<option value="<?php echo $tsqy['code']?>"><?php echo $tsqy['value']?></option>
                                                       	<?php endforeach;?>
                                                       </select>
					</td>
        		</tr>
        										<tr>
                                                    <td class="col1">小店风格</td><td><input type="text" class="def_txt_s4" value="<?php echo $store['style'] ?>" name="style"/><br class="clear"></td>
                                                </tr>
                                                <tr>
                                                    <td class="col1">营业时间</td><td><input type="text" class="def_txt_s4" value="<?php echo $store['bustime'] ?>" name="bustime"/><br class="clear"></td>
                                                </tr>
                                                <tr>
                                                    <td class="col1">联系电话</td><td><input type="text" class="def_txt_s4" value="<?php echo $store['phone'] ?>" name="phone"/><br class="clear"></td>
                                                </tr>
                                                <tr>
                                                    <td class="col1 top">小店文化</td><td><textarea class="def_ta_s4"  name="history"><?php echo $store['history'] ?></textarea></td>
                                                </tr>
                                                <tr>
                                                    <td class="col1">tags</td><td><input name="tags" type="text" value="<?php echo $store['tags'] ?>" class="def_txt_s4" /><span class=" tip_2 ml10">标签</span></td>
                                                </tr>
        	</table>
        </div>
      </div>
      <div class="eTool">
        <input class="button" type="submit" value="保存">
        <input class="button" type="button" id="cancel_button" value="取消">
      </div>
      </form>
    </div>
    </div>
    
    <script type="text/javascript">
    
    $("#storetype").change(function(){
		var fenlei = $(this).val();
		$.post('<?php echo site_url('member/getfenlei')?>',{
				name:fenlei
			},function(data){
				var ret = $.parseJSON(data);
				if(ret.success=='true'){
					$("#storetypes").empty();
					$.each(ret.fenleiList,function(i,obj){
						var options = "<option value='"+obj.code+"'>"+obj.value+"</option>";
						$("#storetypes").append(options);
					});
				}
			});
	});

	$("#storespebus").change(function(){
		var fenlei = $(this).val();
		$.post('<?php echo site_url('member/getfenlei')?>',{
				name:fenlei
			},function(data){
				var ret = $.parseJSON(data);
				if(ret.success=='true'){
					$("#storespebuss").empty();
					$.each(ret.fenleiList,function(i,obj){
						var options = "<option value='"+obj.code+"'>"+obj.value+"</option>";
						$("#storespebuss").append(options);
					});
				}
			});
	});

	$("#cancel_button").click(function(){
		window.location.href="<?php echo site_url('mang/store');?>";
	});
    </script>
  </body>
</html>
